package com.itcast.controller;

import com.itcast.service.WebService;
import com.itcast.vo.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
public class WebController {

    @Autowired
    private WebService webService;

    @GetMapping("/good/search/{page}/{size}")
    public Object queryByKeywordAndPage(@PathVariable(value = "page") String page,
                                 @PathVariable("size") String size,
                                 @RequestParam("keyword") String keyword,
                                 @RequestParam("price") String price,
                                 @RequestParam("create_time") String createTime) throws Exception {
        PageInfo pageInfo = webService.queryByKeywordAndPage(page, size, keyword, price, createTime);
        return pageInfo;
    }

}
